1 /*
2 
3 Boost Software License - Version 1.0 - August 17th, 2003
4 
5 Permission is hereby granted, free of charge, to any person or organization
6 obtaining a copy of the software and accompanying documentation covered by
7 this license ( the "Software" ) to use, reproduce, display, distribute,
8 execute, and transmit the Software, and to prepare derivative works of the
9 Software, and to permit third-parties to whom the Software is furnished to
10 do so, all subject to the following:
11 
12 The copyright notices in the Software and this entire statement, including
13 the above license grant, this restriction and the following disclaimer,
14 must be included in all copies of the Software, in whole or in part, and
15 all derivative works of the Software, unless such copies or derivative
16 works are solely in the form of machine-executable object code generated by
17 a source language processor.
18 
19 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
22 SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
23 FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
24 ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25 DEALINGS IN THE SOFTWARE.
26 
27 */
28 module derelict.udis86.types;
29 
30 import std.stdint;
31 import std.c.stdio;
32 
33 /* -----------------------------------------------------------------------------
34  * All possible "types" of objects in udis86. Order is Important!
35  * -----------------------------------------------------------------------------
36  */
37 alias int ud_type;
38 enum : ud_type
39 {
40     UD_NONE,
41 
42     /* 8 bit GPRs */
43     UD_R_AL,  UD_R_CL,  UD_R_DL,  UD_R_BL,
44     UD_R_AH,  UD_R_CH,  UD_R_DH,  UD_R_BH,
45     UD_R_SPL, UD_R_BPL, UD_R_SIL, UD_R_DIL,
46     UD_R_R8B, UD_R_R9B, UD_R_R10B,  UD_R_R11B,
47     UD_R_R12B,  UD_R_R13B,  UD_R_R14B,  UD_R_R15B,
48 
49     /* 16 bit GPRs */
50     UD_R_AX,  UD_R_CX,  UD_R_DX,  UD_R_BX,
51     UD_R_SP,  UD_R_BP,  UD_R_SI,  UD_R_DI,
52     UD_R_R8W, UD_R_R9W, UD_R_R10W,  UD_R_R11W,
53     UD_R_R12W,  UD_R_R13W,  UD_R_R14W,  UD_R_R15W,
54 
55     /* 32 bit GPRs */
56     UD_R_EAX, UD_R_ECX, UD_R_EDX, UD_R_EBX,
57     UD_R_ESP, UD_R_EBP, UD_R_ESI, UD_R_EDI,
58     UD_R_R8D, UD_R_R9D, UD_R_R10D,  UD_R_R11D,
59     UD_R_R12D,  UD_R_R13D,  UD_R_R14D,  UD_R_R15D,
60 
61     /* 64 bit GPRs */
62     UD_R_RAX, UD_R_RCX, UD_R_RDX, UD_R_RBX,
63     UD_R_RSP, UD_R_RBP, UD_R_RSI, UD_R_RDI,
64     UD_R_R8,  UD_R_R9,  UD_R_R10, UD_R_R11,
65     UD_R_R12, UD_R_R13, UD_R_R14, UD_R_R15,
66 
67     /* segment registers */
68     UD_R_ES,  UD_R_CS,  UD_R_SS,  UD_R_DS,
69     UD_R_FS,  UD_R_GS,  
70 
71     /* control registers*/
72     UD_R_CR0, UD_R_CR1, UD_R_CR2, UD_R_CR3,
73     UD_R_CR4, UD_R_CR5, UD_R_CR6, UD_R_CR7,
74     UD_R_CR8, UD_R_CR9, UD_R_CR10,  UD_R_CR11,
75     UD_R_CR12,  UD_R_CR13,  UD_R_CR14,  UD_R_CR15,
76 
77     /* debug registers */
78     UD_R_DR0, UD_R_DR1, UD_R_DR2, UD_R_DR3,
79     UD_R_DR4, UD_R_DR5, UD_R_DR6, UD_R_DR7,
80     UD_R_DR8, UD_R_DR9, UD_R_DR10,  UD_R_DR11,
81     UD_R_DR12,  UD_R_DR13,  UD_R_DR14,  UD_R_DR15,
82 
83     /* mmx registers */
84     UD_R_MM0, UD_R_MM1, UD_R_MM2, UD_R_MM3,
85     UD_R_MM4, UD_R_MM5, UD_R_MM6, UD_R_MM7,
86 
87     /* x87 registers */
88     UD_R_ST0, UD_R_ST1, UD_R_ST2, UD_R_ST3,
89     UD_R_ST4, UD_R_ST5, UD_R_ST6, UD_R_ST7, 
90 
91     /* extended multimedia registers */
92     UD_R_XMM0,  UD_R_XMM1,  UD_R_XMM2,  UD_R_XMM3,
93     UD_R_XMM4,  UD_R_XMM5,  UD_R_XMM6,  UD_R_XMM7,
94     UD_R_XMM8,  UD_R_XMM9,  UD_R_XMM10, UD_R_XMM11,
95     UD_R_XMM12, UD_R_XMM13, UD_R_XMM14, UD_R_XMM15,
96 
97     /* 256B multimedia registers */
98     UD_R_YMM0,  UD_R_YMM1,  UD_R_YMM2,  UD_R_YMM3,
99     UD_R_YMM4,  UD_R_YMM5,  UD_R_YMM6,  UD_R_YMM7,
100     UD_R_YMM8,  UD_R_YMM9,  UD_R_YMM10, UD_R_YMM11,
101     UD_R_YMM12, UD_R_YMM13, UD_R_YMM14, UD_R_YMM15,
102 
103     UD_R_RIP,
104 
105     /* Operand Types */
106     UD_OP_REG,  UD_OP_MEM,  UD_OP_PTR,  UD_OP_IMM,  
107     UD_OP_JIMM, UD_OP_CONST
108 }
109 
110 /* itab.h -- generated by udis86:scripts/ud_itab.py, do no edit */
111 
112 /* ud_table_type -- lookup table types (see decode.c) */
113 alias int ud_table_type;
114 enum : ud_table_type 
115 {
116     UD_TAB__OPC_VEX,
117     UD_TAB__OPC_TABLE,
118     UD_TAB__OPC_X87,
119     UD_TAB__OPC_MOD,
120     UD_TAB__OPC_RM,
121     UD_TAB__OPC_OSIZE,
122     UD_TAB__OPC_MODE,
123     UD_TAB__OPC_VEX_L,
124     UD_TAB__OPC_3DNOW,
125     UD_TAB__OPC_REG,
126     UD_TAB__OPC_ASIZE,
127     UD_TAB__OPC_VEX_W,
128     UD_TAB__OPC_SSE,
129     UD_TAB__OPC_VENDOR
130 }
131 
132 /* ud_mnemonic -- mnemonic constants */
133 alias int ud_mnemonic_code;
134 enum : ud_mnemonic_code 
135 {
136     UD_Iaaa,
137     UD_Iaad,
138     UD_Iaam,
139     UD_Iaas,
140     UD_Iadc,
141     UD_Iadd,
142     UD_Iaddpd,
143     UD_Iaddps,
144     UD_Iaddsd,
145     UD_Iaddss,
146     UD_Iaddsubpd,
147     UD_Iaddsubps,
148     UD_Iaesdec,
149     UD_Iaesdeclast,
150     UD_Iaesenc,
151     UD_Iaesenclast,
152     UD_Iaesimc,
153     UD_Iaeskeygenassist,
154     UD_Iand,
155     UD_Iandnpd,
156     UD_Iandnps,
157     UD_Iandpd,
158     UD_Iandps,
159     UD_Iarpl,
160     UD_Iblendpd,
161     UD_Iblendps,
162     UD_Iblendvpd,
163     UD_Iblendvps,
164     UD_Ibound,
165     UD_Ibsf,
166     UD_Ibsr,
167     UD_Ibswap,
168     UD_Ibt,
169     UD_Ibtc,
170     UD_Ibtr,
171     UD_Ibts,
172     UD_Icall,
173     UD_Icbw,
174     UD_Icdq,
175     UD_Icdqe,
176     UD_Iclc,
177     UD_Icld,
178     UD_Iclflush,
179     UD_Iclgi,
180     UD_Icli,
181     UD_Iclts,
182     UD_Icmc,
183     UD_Icmova,
184     UD_Icmovae,
185     UD_Icmovb,
186     UD_Icmovbe,
187     UD_Icmovg,
188     UD_Icmovge,
189     UD_Icmovl,
190     UD_Icmovle,
191     UD_Icmovno,
192     UD_Icmovnp,
193     UD_Icmovns,
194     UD_Icmovnz,
195     UD_Icmovo,
196     UD_Icmovp,
197     UD_Icmovs,
198     UD_Icmovz,
199     UD_Icmp,
200     UD_Icmppd,
201     UD_Icmpps,
202     UD_Icmpsb,
203     UD_Icmpsd,
204     UD_Icmpsq,
205     UD_Icmpss,
206     UD_Icmpsw,
207     UD_Icmpxchg,
208     UD_Icmpxchg16b,
209     UD_Icmpxchg8b,
210     UD_Icomisd,
211     UD_Icomiss,
212     UD_Icpuid,
213     UD_Icqo,
214     UD_Icrc32,
215     UD_Icvtdq2pd,
216     UD_Icvtdq2ps,
217     UD_Icvtpd2dq,
218     UD_Icvtpd2pi,
219     UD_Icvtpd2ps,
220     UD_Icvtpi2pd,
221     UD_Icvtpi2ps,
222     UD_Icvtps2dq,
223     UD_Icvtps2pd,
224     UD_Icvtps2pi,
225     UD_Icvtsd2si,
226     UD_Icvtsd2ss,
227     UD_Icvtsi2sd,
228     UD_Icvtsi2ss,
229     UD_Icvtss2sd,
230     UD_Icvtss2si,
231     UD_Icvttpd2dq,
232     UD_Icvttpd2pi,
233     UD_Icvttps2dq,
234     UD_Icvttps2pi,
235     UD_Icvttsd2si,
236     UD_Icvttss2si,
237     UD_Icwd,
238     UD_Icwde,
239     UD_Idaa,
240     UD_Idas,
241     UD_Idec,
242     UD_Idiv,
243     UD_Idivpd,
244     UD_Idivps,
245     UD_Idivsd,
246     UD_Idivss,
247     UD_Idppd,
248     UD_Idpps,
249     UD_Iemms,
250     UD_Ienter,
251     UD_Iextractps,
252     UD_If2xm1,
253     UD_Ifabs,
254     UD_Ifadd,
255     UD_Ifaddp,
256     UD_Ifbld,
257     UD_Ifbstp,
258     UD_Ifchs,
259     UD_Ifclex,
260     UD_Ifcmovb,
261     UD_Ifcmovbe,
262     UD_Ifcmove,
263     UD_Ifcmovnb,
264     UD_Ifcmovnbe,
265     UD_Ifcmovne,
266     UD_Ifcmovnu,
267     UD_Ifcmovu,
268     UD_Ifcom,
269     UD_Ifcom2,
270     UD_Ifcomi,
271     UD_Ifcomip,
272     UD_Ifcomp,
273     UD_Ifcomp3,
274     UD_Ifcomp5,
275     UD_Ifcompp,
276     UD_Ifcos,
277     UD_Ifdecstp,
278     UD_Ifdiv,
279     UD_Ifdivp,
280     UD_Ifdivr,
281     UD_Ifdivrp,
282     UD_Ifemms,
283     UD_Iffree,
284     UD_Iffreep,
285     UD_Ifiadd,
286     UD_Ificom,
287     UD_Ificomp,
288     UD_Ifidiv,
289     UD_Ifidivr,
290     UD_Ifild,
291     UD_Ifimul,
292     UD_Ifincstp,
293     UD_Ifist,
294     UD_Ifistp,
295     UD_Ifisttp,
296     UD_Ifisub,
297     UD_Ifisubr,
298     UD_Ifld,
299     UD_Ifld1,
300     UD_Ifldcw,
301     UD_Ifldenv,
302     UD_Ifldl2e,
303     UD_Ifldl2t,
304     UD_Ifldlg2,
305     UD_Ifldln2,
306     UD_Ifldpi,
307     UD_Ifldz,
308     UD_Ifmul,
309     UD_Ifmulp,
310     UD_Ifninit,
311     UD_Ifnop,
312     UD_Ifnsave,
313     UD_Ifnstcw,
314     UD_Ifnstenv,
315     UD_Ifnstsw,
316     UD_Ifpatan,
317     UD_Ifprem,
318     UD_Ifprem1,
319     UD_Ifptan,
320     UD_Ifrndint,
321     UD_Ifrstor,
322     UD_Ifscale,
323     UD_Ifsin,
324     UD_Ifsincos,
325     UD_Ifsqrt,
326     UD_Ifst,
327     UD_Ifstp,
328     UD_Ifstp1,
329     UD_Ifstp8,
330     UD_Ifstp9,
331     UD_Ifsub,
332     UD_Ifsubp,
333     UD_Ifsubr,
334     UD_Ifsubrp,
335     UD_Iftst,
336     UD_Ifucom,
337     UD_Ifucomi,
338     UD_Ifucomip,
339     UD_Ifucomp,
340     UD_Ifucompp,
341     UD_Ifxam,
342     UD_Ifxch,
343     UD_Ifxch4,
344     UD_Ifxch7,
345     UD_Ifxrstor,
346     UD_Ifxsave,
347     UD_Ifxtract,
348     UD_Ifyl2x,
349     UD_Ifyl2xp1,
350     UD_Igetsec,
351     UD_Ihaddpd,
352     UD_Ihaddps,
353     UD_Ihlt,
354     UD_Ihsubpd,
355     UD_Ihsubps,
356     UD_Iidiv,
357     UD_Iimul,
358     UD_Iin,
359     UD_Iinc,
360     UD_Iinsb,
361     UD_Iinsd,
362     UD_Iinsertps,
363     UD_Iinsw,
364     UD_Iint,
365     UD_Iint1,
366     UD_Iint3,
367     UD_Iinto,
368     UD_Iinvd,
369     UD_Iinvept,
370     UD_Iinvlpg,
371     UD_Iinvlpga,
372     UD_Iinvvpid,
373     UD_Iiretd,
374     UD_Iiretq,
375     UD_Iiretw,
376     UD_Ija,
377     UD_Ijae,
378     UD_Ijb,
379     UD_Ijbe,
380     UD_Ijcxz,
381     UD_Ijecxz,
382     UD_Ijg,
383     UD_Ijge,
384     UD_Ijl,
385     UD_Ijle,
386     UD_Ijmp,
387     UD_Ijno,
388     UD_Ijnp,
389     UD_Ijns,
390     UD_Ijnz,
391     UD_Ijo,
392     UD_Ijp,
393     UD_Ijrcxz,
394     UD_Ijs,
395     UD_Ijz,
396     UD_Ilahf,
397     UD_Ilar,
398     UD_Ilddqu,
399     UD_Ildmxcsr,
400     UD_Ilds,
401     UD_Ilea,
402     UD_Ileave,
403     UD_Iles,
404     UD_Ilfence,
405     UD_Ilfs,
406     UD_Ilgdt,
407     UD_Ilgs,
408     UD_Ilidt,
409     UD_Illdt,
410     UD_Ilmsw,
411     UD_Ilock,
412     UD_Ilodsb,
413     UD_Ilodsd,
414     UD_Ilodsq,
415     UD_Ilodsw,
416     UD_Iloop,
417     UD_Iloope,
418     UD_Iloopne,
419     UD_Ilsl,
420     UD_Ilss,
421     UD_Iltr,
422     UD_Imaskmovdqu,
423     UD_Imaskmovq,
424     UD_Imaxpd,
425     UD_Imaxps,
426     UD_Imaxsd,
427     UD_Imaxss,
428     UD_Imfence,
429     UD_Iminpd,
430     UD_Iminps,
431     UD_Iminsd,
432     UD_Iminss,
433     UD_Imonitor,
434     UD_Imontmul,
435     UD_Imov,
436     UD_Imovapd,
437     UD_Imovaps,
438     UD_Imovbe,
439     UD_Imovd,
440     UD_Imovddup,
441     UD_Imovdq2q,
442     UD_Imovdqa,
443     UD_Imovdqu,
444     UD_Imovhlps,
445     UD_Imovhpd,
446     UD_Imovhps,
447     UD_Imovlhps,
448     UD_Imovlpd,
449     UD_Imovlps,
450     UD_Imovmskpd,
451     UD_Imovmskps,
452     UD_Imovntdq,
453     UD_Imovntdqa,
454     UD_Imovnti,
455     UD_Imovntpd,
456     UD_Imovntps,
457     UD_Imovntq,
458     UD_Imovq,
459     UD_Imovq2dq,
460     UD_Imovsb,
461     UD_Imovsd,
462     UD_Imovshdup,
463     UD_Imovsldup,
464     UD_Imovsq,
465     UD_Imovss,
466     UD_Imovsw,
467     UD_Imovsx,
468     UD_Imovsxd,
469     UD_Imovupd,
470     UD_Imovups,
471     UD_Imovzx,
472     UD_Impsadbw,
473     UD_Imul,
474     UD_Imulpd,
475     UD_Imulps,
476     UD_Imulsd,
477     UD_Imulss,
478     UD_Imwait,
479     UD_Ineg,
480     UD_Inop,
481     UD_Inot,
482     UD_Ior,
483     UD_Iorpd,
484     UD_Iorps,
485     UD_Iout,
486     UD_Ioutsb,
487     UD_Ioutsd,
488     UD_Ioutsw,
489     UD_Ipabsb,
490     UD_Ipabsd,
491     UD_Ipabsw,
492     UD_Ipackssdw,
493     UD_Ipacksswb,
494     UD_Ipackusdw,
495     UD_Ipackuswb,
496     UD_Ipaddb,
497     UD_Ipaddd,
498     UD_Ipaddq,
499     UD_Ipaddsb,
500     UD_Ipaddsw,
501     UD_Ipaddusb,
502     UD_Ipaddusw,
503     UD_Ipaddw,
504     UD_Ipalignr,
505     UD_Ipand,
506     UD_Ipandn,
507     UD_Ipavgb,
508     UD_Ipavgusb,
509     UD_Ipavgw,
510     UD_Ipblendvb,
511     UD_Ipblendw,
512     UD_Ipclmulqdq,
513     UD_Ipcmpeqb,
514     UD_Ipcmpeqd,
515     UD_Ipcmpeqq,
516     UD_Ipcmpeqw,
517     UD_Ipcmpestri,
518     UD_Ipcmpestrm,
519     UD_Ipcmpgtb,
520     UD_Ipcmpgtd,
521     UD_Ipcmpgtq,
522     UD_Ipcmpgtw,
523     UD_Ipcmpistri,
524     UD_Ipcmpistrm,
525     UD_Ipextrb,
526     UD_Ipextrd,
527     UD_Ipextrq,
528     UD_Ipextrw,
529     UD_Ipf2id,
530     UD_Ipf2iw,
531     UD_Ipfacc,
532     UD_Ipfadd,
533     UD_Ipfcmpeq,
534     UD_Ipfcmpge,
535     UD_Ipfcmpgt,
536     UD_Ipfmax,
537     UD_Ipfmin,
538     UD_Ipfmul,
539     UD_Ipfnacc,
540     UD_Ipfpnacc,
541     UD_Ipfrcp,
542     UD_Ipfrcpit1,
543     UD_Ipfrcpit2,
544     UD_Ipfrsqit1,
545     UD_Ipfrsqrt,
546     UD_Ipfsub,
547     UD_Ipfsubr,
548     UD_Iphaddd,
549     UD_Iphaddsw,
550     UD_Iphaddw,
551     UD_Iphminposuw,
552     UD_Iphsubd,
553     UD_Iphsubsw,
554     UD_Iphsubw,
555     UD_Ipi2fd,
556     UD_Ipi2fw,
557     UD_Ipinsrb,
558     UD_Ipinsrd,
559     UD_Ipinsrq,
560     UD_Ipinsrw,
561     UD_Ipmaddubsw,
562     UD_Ipmaddwd,
563     UD_Ipmaxsb,
564     UD_Ipmaxsd,
565     UD_Ipmaxsw,
566     UD_Ipmaxub,
567     UD_Ipmaxud,
568     UD_Ipmaxuw,
569     UD_Ipminsb,
570     UD_Ipminsd,
571     UD_Ipminsw,
572     UD_Ipminub,
573     UD_Ipminud,
574     UD_Ipminuw,
575     UD_Ipmovmskb,
576     UD_Ipmovsxbd,
577     UD_Ipmovsxbq,
578     UD_Ipmovsxbw,
579     UD_Ipmovsxdq,
580     UD_Ipmovsxwd,
581     UD_Ipmovsxwq,
582     UD_Ipmovzxbd,
583     UD_Ipmovzxbq,
584     UD_Ipmovzxbw,
585     UD_Ipmovzxdq,
586     UD_Ipmovzxwd,
587     UD_Ipmovzxwq,
588     UD_Ipmuldq,
589     UD_Ipmulhrsw,
590     UD_Ipmulhrw,
591     UD_Ipmulhuw,
592     UD_Ipmulhw,
593     UD_Ipmulld,
594     UD_Ipmullw,
595     UD_Ipmuludq,
596     UD_Ipop,
597     UD_Ipopa,
598     UD_Ipopad,
599     UD_Ipopcnt,
600     UD_Ipopfd,
601     UD_Ipopfq,
602     UD_Ipopfw,
603     UD_Ipor,
604     UD_Iprefetch,
605     UD_Iprefetchnta,
606     UD_Iprefetcht0,
607     UD_Iprefetcht1,
608     UD_Iprefetcht2,
609     UD_Ipsadbw,
610     UD_Ipshufb,
611     UD_Ipshufd,
612     UD_Ipshufhw,
613     UD_Ipshuflw,
614     UD_Ipshufw,
615     UD_Ipsignb,
616     UD_Ipsignd,
617     UD_Ipsignw,
618     UD_Ipslld,
619     UD_Ipslldq,
620     UD_Ipsllq,
621     UD_Ipsllw,
622     UD_Ipsrad,
623     UD_Ipsraw,
624     UD_Ipsrld,
625     UD_Ipsrldq,
626     UD_Ipsrlq,
627     UD_Ipsrlw,
628     UD_Ipsubb,
629     UD_Ipsubd,
630     UD_Ipsubq,
631     UD_Ipsubsb,
632     UD_Ipsubsw,
633     UD_Ipsubusb,
634     UD_Ipsubusw,
635     UD_Ipsubw,
636     UD_Ipswapd,
637     UD_Iptest,
638     UD_Ipunpckhbw,
639     UD_Ipunpckhdq,
640     UD_Ipunpckhqdq,
641     UD_Ipunpckhwd,
642     UD_Ipunpcklbw,
643     UD_Ipunpckldq,
644     UD_Ipunpcklqdq,
645     UD_Ipunpcklwd,
646     UD_Ipush,
647     UD_Ipusha,
648     UD_Ipushad,
649     UD_Ipushfd,
650     UD_Ipushfq,
651     UD_Ipushfw,
652     UD_Ipxor,
653     UD_Ircl,
654     UD_Ircpps,
655     UD_Ircpss,
656     UD_Ircr,
657     UD_Irdmsr,
658     UD_Irdpmc,
659     UD_Irdtsc,
660     UD_Irdtscp,
661     UD_Irep,
662     UD_Irepne,
663     UD_Iret,
664     UD_Iretf,
665     UD_Irol,
666     UD_Iror,
667     UD_Iroundpd,
668     UD_Iroundps,
669     UD_Iroundsd,
670     UD_Iroundss,
671     UD_Irsm,
672     UD_Irsqrtps,
673     UD_Irsqrtss,
674     UD_Isahf,
675     UD_Isalc,
676     UD_Isar,
677     UD_Isbb,
678     UD_Iscasb,
679     UD_Iscasd,
680     UD_Iscasq,
681     UD_Iscasw,
682     UD_Iseta,
683     UD_Isetae,
684     UD_Isetb,
685     UD_Isetbe,
686     UD_Isetg,
687     UD_Isetge,
688     UD_Isetl,
689     UD_Isetle,
690     UD_Isetno,
691     UD_Isetnp,
692     UD_Isetns,
693     UD_Isetnz,
694     UD_Iseto,
695     UD_Isetp,
696     UD_Isets,
697     UD_Isetz,
698     UD_Isfence,
699     UD_Isgdt,
700     UD_Ishl,
701     UD_Ishld,
702     UD_Ishr,
703     UD_Ishrd,
704     UD_Ishufpd,
705     UD_Ishufps,
706     UD_Isidt,
707     UD_Iskinit,
708     UD_Isldt,
709     UD_Ismsw,
710     UD_Isqrtpd,
711     UD_Isqrtps,
712     UD_Isqrtsd,
713     UD_Isqrtss,
714     UD_Istc,
715     UD_Istd,
716     UD_Istgi,
717     UD_Isti,
718     UD_Istmxcsr,
719     UD_Istosb,
720     UD_Istosd,
721     UD_Istosq,
722     UD_Istosw,
723     UD_Istr,
724     UD_Isub,
725     UD_Isubpd,
726     UD_Isubps,
727     UD_Isubsd,
728     UD_Isubss,
729     UD_Iswapgs,
730     UD_Isyscall,
731     UD_Isysenter,
732     UD_Isysexit,
733     UD_Isysret,
734     UD_Itest,
735     UD_Iucomisd,
736     UD_Iucomiss,
737     UD_Iud2,
738     UD_Iunpckhpd,
739     UD_Iunpckhps,
740     UD_Iunpcklpd,
741     UD_Iunpcklps,
742     UD_Ivaddpd,
743     UD_Ivaddps,
744     UD_Ivaddsd,
745     UD_Ivaddss,
746     UD_Ivaddsubpd,
747     UD_Ivaddsubps,
748     UD_Ivaesdec,
749     UD_Ivaesdeclast,
750     UD_Ivaesenc,
751     UD_Ivaesenclast,
752     UD_Ivaesimc,
753     UD_Ivaeskeygenassist,
754     UD_Ivandnpd,
755     UD_Ivandnps,
756     UD_Ivandpd,
757     UD_Ivandps,
758     UD_Ivblendpd,
759     UD_Ivblendps,
760     UD_Ivblendvpd,
761     UD_Ivblendvps,
762     UD_Ivbroadcastsd,
763     UD_Ivbroadcastss,
764     UD_Ivcmppd,
765     UD_Ivcmpps,
766     UD_Ivcmpsd,
767     UD_Ivcmpss,
768     UD_Ivcomisd,
769     UD_Ivcomiss,
770     UD_Ivcvtdq2pd,
771     UD_Ivcvtdq2ps,
772     UD_Ivcvtpd2dq,
773     UD_Ivcvtpd2ps,
774     UD_Ivcvtps2dq,
775     UD_Ivcvtps2pd,
776     UD_Ivcvtsd2si,
777     UD_Ivcvtsd2ss,
778     UD_Ivcvtsi2sd,
779     UD_Ivcvtsi2ss,
780     UD_Ivcvtss2sd,
781     UD_Ivcvtss2si,
782     UD_Ivcvttpd2dq,
783     UD_Ivcvttps2dq,
784     UD_Ivcvttsd2si,
785     UD_Ivcvttss2si,
786     UD_Ivdivpd,
787     UD_Ivdivps,
788     UD_Ivdivsd,
789     UD_Ivdivss,
790     UD_Ivdppd,
791     UD_Ivdpps,
792     UD_Iverr,
793     UD_Iverw,
794     UD_Ivextractf128,
795     UD_Ivextractps,
796     UD_Ivhaddpd,
797     UD_Ivhaddps,
798     UD_Ivhsubpd,
799     UD_Ivhsubps,
800     UD_Ivinsertf128,
801     UD_Ivinsertps,
802     UD_Ivlddqu,
803     UD_Ivmaskmovdqu,
804     UD_Ivmaskmovpd,
805     UD_Ivmaskmovps,
806     UD_Ivmaxpd,
807     UD_Ivmaxps,
808     UD_Ivmaxsd,
809     UD_Ivmaxss,
810     UD_Ivmcall,
811     UD_Ivmclear,
812     UD_Ivminpd,
813     UD_Ivminps,
814     UD_Ivminsd,
815     UD_Ivminss,
816     UD_Ivmlaunch,
817     UD_Ivmload,
818     UD_Ivmmcall,
819     UD_Ivmovapd,
820     UD_Ivmovaps,
821     UD_Ivmovd,
822     UD_Ivmovdqu,
823     UD_Ivmovhlps,
824     UD_Ivmovhpd,
825     UD_Ivmovhps,
826     UD_Ivmovlhps,
827     UD_Ivmovmskpd,
828     UD_Ivmovmskps,
829     UD_Ivmovntdq,
830     UD_Ivmovntdqa,
831     UD_Ivmovntpd,
832     UD_Ivmovntps,
833     UD_Ivmovq,
834     UD_Ivmovsd,
835     UD_Ivmovshdup,
836     UD_Ivmovsldup,
837     UD_Ivmovss,
838     UD_Ivmovupd,
839     UD_Ivmovups,
840     UD_Ivmpsadbw,
841     UD_Ivmptrld,
842     UD_Ivmptrst,
843     UD_Ivmread,
844     UD_Ivmresume,
845     UD_Ivmrun,
846     UD_Ivmsave,
847     UD_Ivmulpd,
848     UD_Ivmulps,
849     UD_Ivmulsd,
850     UD_Ivmulss,
851     UD_Ivmwrite,
852     UD_Ivmxoff,
853     UD_Ivmxon,
854     UD_Ivorpd,
855     UD_Ivorps,
856     UD_Ivpabsb,
857     UD_Ivpabsd,
858     UD_Ivpabsw,
859     UD_Ivpackssdw,
860     UD_Ivpacksswb,
861     UD_Ivpackusdw,
862     UD_Ivpackuswb,
863     UD_Ivpaddb,
864     UD_Ivpaddd,
865     UD_Ivpaddq,
866     UD_Ivpaddsb,
867     UD_Ivpaddsw,
868     UD_Ivpaddusb,
869     UD_Ivpaddusw,
870     UD_Ivpaddw,
871     UD_Ivpalignr,
872     UD_Ivpand,
873     UD_Ivpandn,
874     UD_Ivpavgb,
875     UD_Ivpavgw,
876     UD_Ivpblendvb,
877     UD_Ivpblendw,
878     UD_Ivpclmulqdq,
879     UD_Ivpcmpeqb,
880     UD_Ivpcmpeqd,
881     UD_Ivpcmpeqq,
882     UD_Ivpcmpeqw,
883     UD_Ivpcmpestri,
884     UD_Ivpcmpestrm,
885     UD_Ivpcmpgtb,
886     UD_Ivpcmpgtd,
887     UD_Ivpcmpgtq,
888     UD_Ivpcmpgtw,
889     UD_Ivpcmpistri,
890     UD_Ivpcmpistrm,
891     UD_Ivperm2f128,
892     UD_Ivpermilpd,
893     UD_Ivpermilps,
894     UD_Ivpextrb,
895     UD_Ivpextrd,
896     UD_Ivpextrq,
897     UD_Ivpextrw,
898     UD_Ivphaddd,
899     UD_Ivphaddsw,
900     UD_Ivphaddw,
901     UD_Ivphminposuw,
902     UD_Ivphsubd,
903     UD_Ivphsubsw,
904     UD_Ivphsubw,
905     UD_Ivpinsrb,
906     UD_Ivpinsrd,
907     UD_Ivpinsrq,
908     UD_Ivpinsrw,
909     UD_Ivpmaddubsw,
910     UD_Ivpmaddwd,
911     UD_Ivpmaxsb,
912     UD_Ivpmaxsd,
913     UD_Ivpmaxsw,
914     UD_Ivpmaxub,
915     UD_Ivpmaxud,
916     UD_Ivpmaxuw,
917     UD_Ivpminsb,
918     UD_Ivpminsd,
919     UD_Ivpminsw,
920     UD_Ivpminub,
921     UD_Ivpminud,
922     UD_Ivpminuw,
923     UD_Ivpmovmskb,
924     UD_Ivpmovsxbd,
925     UD_Ivpmovsxbq,
926     UD_Ivpmovsxbw,
927     UD_Ivpmovsxwd,
928     UD_Ivpmovsxwq,
929     UD_Ivpmovzxbd,
930     UD_Ivpmovzxbq,
931     UD_Ivpmovzxbw,
932     UD_Ivpmovzxdq,
933     UD_Ivpmovzxwd,
934     UD_Ivpmovzxwq,
935     UD_Ivpmuldq,
936     UD_Ivpmulhrsw,
937     UD_Ivpmulhuw,
938     UD_Ivpmulhw,
939     UD_Ivpmulld,
940     UD_Ivpmullw,
941     UD_Ivpor,
942     UD_Ivpsadbw,
943     UD_Ivpshufb,
944     UD_Ivpshufd,
945     UD_Ivpshufhw,
946     UD_Ivpshuflw,
947     UD_Ivpsignb,
948     UD_Ivpsignd,
949     UD_Ivpsignw,
950     UD_Ivpslld,
951     UD_Ivpslldq,
952     UD_Ivpsllq,
953     UD_Ivpsllw,
954     UD_Ivpsrad,
955     UD_Ivpsraw,
956     UD_Ivpsrld,
957     UD_Ivpsrldq,
958     UD_Ivpsrlq,
959     UD_Ivpsrlw,
960     UD_Ivpsubb,
961     UD_Ivpsubd,
962     UD_Ivpsubq,
963     UD_Ivpsubsb,
964     UD_Ivpsubsw,
965     UD_Ivpsubusb,
966     UD_Ivpsubusw,
967     UD_Ivpsubw,
968     UD_Ivptest,
969     UD_Ivpunpckhbw,
970     UD_Ivpunpckhdq,
971     UD_Ivpunpckhqdq,
972     UD_Ivpunpckhwd,
973     UD_Ivpunpcklbw,
974     UD_Ivpunpckldq,
975     UD_Ivpunpcklwd,
976     UD_Ivpxor,
977     UD_Ivrcpps,
978     UD_Ivrcpss,
979     UD_Ivroundpd,
980     UD_Ivroundps,
981     UD_Ivroundsd,
982     UD_Ivroundss,
983     UD_Ivrsqrtps,
984     UD_Ivrsqrtss,
985     UD_Ivshufpd,
986     UD_Ivshufps,
987     UD_Ivsqrtpd,
988     UD_Ivsqrtps,
989     UD_Ivsqrtsd,
990     UD_Ivsqrtss,
991     UD_Ivstmxcsr,
992     UD_Ivsubpd,
993     UD_Ivsubps,
994     UD_Ivsubsd,
995     UD_Ivsubss,
996     UD_Ivtestpd,
997     UD_Ivtestps,
998     UD_Ivucomisd,
999     UD_Ivucomiss,
1000     UD_Ivunpckhpd,
1001     UD_Ivunpckhps,
1002     UD_Ivunpcklpd,
1003     UD_Ivunpcklps,
1004     UD_Ivxorpd,
1005     UD_Ivxorps,
1006     UD_Ivzeroall,
1007     UD_Ivzeroupper,
1008     UD_Iwait,
1009     UD_Iwbinvd,
1010     UD_Iwrmsr,
1011     UD_Ixadd,
1012     UD_Ixchg,
1013     UD_Ixcryptcbc,
1014     UD_Ixcryptcfb,
1015     UD_Ixcryptctr,
1016     UD_Ixcryptecb,
1017     UD_Ixcryptofb,
1018     UD_Ixgetbv,
1019     UD_Ixlatb,
1020     UD_Ixor,
1021     UD_Ixorpd,
1022     UD_Ixorps,
1023     UD_Ixrstor,
1024     UD_Ixsave,
1025     UD_Ixsetbv,
1026     UD_Ixsha1,
1027     UD_Ixsha256,
1028     UD_Ixstore,
1029     UD_Iinvalid,
1030     UD_I3dnow,
1031     UD_Inone,
1032     UD_Idb,
1033     UD_Ipause,
1034     UD_MAX_MNEMONIC_CODE
1035 }
1036 
1037 union ud_lval 
1038 {
1039     int8_t     sbyte;
1040     uint8_t    ubyte_;
1041     int16_t    sword;
1042     uint16_t   uword;
1043     int32_t    sdword;
1044     uint32_t   udword;
1045     int64_t    sqword;
1046     uint64_t   uqword;
1047     struct _seg_offs
1048     {
1049         uint16_t seg;
1050         uint32_t off;
1051     }
1052     _seg_offs  ptr;
1053 }
1054 
1055 /* -----------------------------------------------------------------------------
1056  * struct ud_operand - Disassembled instruction Operand.
1057  * -----------------------------------------------------------------------------
1058  */
1059 struct ud_operand 
1060 {
1061     ud_type         type;
1062     uint8_t         size;
1063     ud_type         base;
1064     ud_type         index;
1065     uint8_t         scale;  
1066     uint8_t         offset;
1067     ud_lval         lval;
1068     uint64_t        disp;
1069     /*
1070      * internal use only
1071      */
1072     uint8_t         _oprcode;
1073 }
1074 
1075 /* -----------------------------------------------------------------------------
1076  * struct ud - The udis86 object.
1077  * -----------------------------------------------------------------------------
1078  */
1079 alias extern(C) int function(ud*) input_hook_t;
1080 alias extern(C) void function(ud*) translator_t;
1081 alias extern(C) const(char)* function(ud*, uint64_t addr, int64_t* offset) sym_resolver_t;
1082 struct ud
1083 {
1084     /*
1085      * input buffering
1086      */
1087     input_hook_t inp_hook;
1088     FILE*     inp_file;
1089     const uint8_t* inp_buf;
1090     size_t    inp_buf_size;
1091     size_t    inp_buf_index;
1092     uint8_t   inp_curr;
1093     size_t    inp_ctr;
1094     uint8_t   inp_sess[64];
1095     int       inp_end;
1096     int       inp_peek;
1097     
1098     translator_t translator;
1099     uint64_t  insn_offset;
1100     char      insn_hexcode[64];
1101     
1102     /*
1103      * Assembly output buffer
1104      */
1105     char     *asm_buf;
1106     size_t    asm_buf_size;
1107     size_t    asm_buf_fill;
1108     char      asm_buf_int[128];
1109     
1110     /*
1111      * Symbol resolver for use in the translation phase.
1112      */
1113     sym_resolver_t sym_resolver;
1114     uint8_t   dis_mode;
1115     uint64_t  pc;
1116     uint8_t   vendor;
1117     ud_mnemonic_code mnemonic;
1118     ud_operand operand[4];
1119     uint8_t   error;
1120     uint8_t   _rex;
1121     uint8_t   pfx_rex;
1122     uint8_t   pfx_seg;
1123     uint8_t   pfx_opr;
1124     uint8_t   pfx_adr;
1125     uint8_t   pfx_lock;
1126     uint8_t   pfx_str;
1127     uint8_t   pfx_rep;
1128     uint8_t   pfx_repe;
1129     uint8_t   pfx_repne;
1130     uint8_t   opr_mode;
1131     uint8_t   adr_mode;
1132     uint8_t   br_far;
1133     uint8_t   br_near;
1134     uint8_t   have_modrm;
1135     uint8_t   modrm;
1136     uint8_t   vex_op;
1137     uint8_t   vex_b1;
1138     uint8_t   vex_b2;
1139     uint8_t   primary_opcode;
1140     void *    user_opaque_data;
1141     void *    itab_entry;
1142     void *    le;
1143 }
1144 
1145 /* -----------------------------------------------------------------------------
1146  * Type-definitions
1147  * -----------------------------------------------------------------------------
1148  */
1149 enum UD_EOI = (-1);
1150 enum UD_INP_CACHE_SZ = 32;
1151 enum UD_VENDOR_AMD = 0;
1152 enum UD_VENDOR_INTEL = 1;
1153 enum UD_VENDOR_ANY = 2;
1154 extern(C) __gshared const(char**) ud_mnemonics_str;